﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<OGS.Web.Models.Admin.SaveCategoryModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%= OGS.Utility.Helper.GetPageTitle("Save Category") %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <%-- Main content--%>
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <ol class="breadcrumb">
                    <li><a href="/admin/manage-dashboard">Home</a></li>
                    <li><a href="/admin/category-list">Category List</a></li>
                    <li class="active">Save Category</li>
                </ol>
            </div>
            <div class="col-md-8 col-md-offset-2">
                <% using (Html.BeginForm("Save-Category", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
                   { %>
                <%: Html.AntiForgeryToken() %>
                <%: Html.HiddenFor(m => m.ID) %>
                <div class="well well-White">
                    <div class="bs-example form-horizontal">
                        <fieldset>
                            <legend>Save Category</legend>
                            <% if (Model.IsSuccess)
                               { %>
                            <div class="alert alert-success">
                                <a href="#" class="close" data-dismiss="alert">&times;</a>
                                <strong>Success!</strong> Category saved successfully. <a href="/admin/save-Category">Click here </a>to add new.
                            </div>
                            <% } %>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.Code, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.Code, new { @class = "form-control", @maxlength = "20" })%>
                                    <%: Html.ValidationMessageFor(m => m.Code) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.EnglishName, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.EnglishName, new { @class = "form-control", @maxlength = "100" })%>
                                    <%: Html.ValidationMessageFor(m => m.EnglishName) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.BengaliName, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.BengaliName, new { @class = "form-control", @maxlength = "100" })%>
                                    <%: Html.ValidationMessageFor(m => m.BengaliName) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.HindiName, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.HindiName, new { @class = "form-control", @maxlength = "100" })%>
                                    <%: Html.ValidationMessageFor(m => m.HindiName) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.Url, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.Url, new { @class = "form-control", @maxlength = "100" })%>
                                    <%: Html.ValidationMessageFor(m => m.Url) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.ParentCategoryID, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.DropDownListFor(m => m.ParentCategoryID, new SelectList(Model.ParentCategories, "ID", "ComputedName"), new { @class = "form-control" })%>
                                    <%: Html.ValidationMessageFor(m => m.ParentCategoryID) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.DisplayOrder, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.DisplayOrder, new { @class = "form-control", @maxlength = "3" })%>
                                    <%: Html.ValidationMessageFor(m => m.DisplayOrder) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.CategoryImage, new { @class="col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.TextBoxFor(m => m.CategoryImage, new { @class = "input-file", @maxlength = "100", @type = "file", @style= "padding-top:6px" })%>
                                    <p class="help-block">Upload only *.jpg,*.gif or *.png file.</p>
                                    <%: Html.ValidationMessageFor(m => m.CategoryImage) %>
                                </div>
                            </div>
                            <% if (!string.IsNullOrEmpty(Model.Image))
                               { %>
                            <div class="form-group">
                                <div class="col-lg-3"></div>
                                <div class="col-lg-9">
                                    <img alt="" src="/UploadedFiles/CategoryImages/<%=Model.Image %>" width="200" />
                                </div>
                            </div>
                            <% } %>
                            <div class="form-group">
                                <%: Html.LabelFor(m => m.IsActive, new { @class = "col-lg-3 control-label" })%>
                                <div class="col-lg-9">
                                    <%: Html.CheckBoxFor(m => m.IsActive) %>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-lg-9 col-lg-offset-3">
                                    <input type="submit" class="btn btn-primary" value="Save" />
                                    <a href="/admin/Category-list" class="btn btn-default">Cancel</a>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </div>
                <% } %>
            </div>
        </div>
    </section>
    <%--/.content --%>
    <script type="text/javascript">

        $(document).ready(function () {
            $("#EnglishName").on("blur", function () {
                $("#Url").val($("#EnglishName").val().toSeoURL());
                if ($.trim($("#BengaliName").val()) == "") {
                    $("#BengaliName").val($("#EnglishName").val());
                }
                if ($.trim($("#HindiName").val()) == "") {
                    $("#HindiName").val($("#EnglishName").val());
                }
            });
            //enable validation
            enableValidation();
        });




    </script>
</asp:Content>
